#!/bin/sh
#
# Use this when doing code development

set -ex

make -k distclean > /dev/null 2>&1 || true

# Prefer CLANG if we have it, and have not given preferences
if [ -f /usr/bin/clang -a "x${CC}" = "x" ] ; then
	CC=clang
	export CC
fi

rm -f configure
. ./autogen.sh

# autoconf prior to 2.62 has issues with zsh 4.2 and newer
export CONFIG_SHELL=/bin/sh

# NB: Workaround for make distcheck not working with
# NB: FreeBSD's make on -current
# env MAKE=gmake \
./configure \
    --enable-developer-warnings \
    --enable-debugging-symbols \
    --enable-dependency-tracking \
    --enable-tests \
    --prefix=/opt/varnish \
    --mandir=/opt/varnish/man \
    "$@"
